package cn.darkhorse.mesadmin.controller.ticket;



import cn.darkhorse.ticket.basis.pojo.TicketWarehouseInfo;
import cn.darkhorse.ticket.basis.service.TicketWarehouseInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 仓库信息 前端控制器
 * </p>
 *
 * @author maoguanjun
 * @since 2024-01-10
 */
@RestController
@RequestMapping("/ticket/ticketWarehouseInfo")
public class TicketWarehouseInfoController extends BaseController {
    @Resource
    private TicketWarehouseInfoService ticketWarehouseInfoService;
    @RequestMapping("/list")
    public TableDataInfo list(String dataName){
        startPage();
        List<TicketWarehouseInfo> list=ticketWarehouseInfoService.listAll(dataName);
        return getDataTable(list);
    }

    @RequestMapping("/view")
    public AjaxResult view(Long dataId){
        if(null==dataId){
            return  AjaxResult.error("参数为空！");
        }
        TicketWarehouseInfo result=ticketWarehouseInfoService.view(dataId);
        return AjaxResult.success(result);
    }

    @RequestMapping("/save")
    public AjaxResult save(@RequestBody TicketWarehouseInfo info){
        boolean result=ticketWarehouseInfoService.saveData(info);
        return AjaxResult.success(result);
    }

    @RequestMapping("/delete")
    public AjaxResult delete(Long dataId){
        if(null==dataId){
            return  AjaxResult.error("参数为空！");
        }
        boolean result=ticketWarehouseInfoService.delete(dataId);
        return AjaxResult.success(result);
    }

    /**
     * 是否被引用
     * @param dataId
     * @return
     */
    @RequestMapping("/is_quote")
    public AjaxResult isQuote(Long dataId){
        if(null==dataId){
            return AjaxResult.error("参数为空！");
        }
        boolean result=ticketWarehouseInfoService.isQuote(dataId);
        return AjaxResult.success(result);
    }
}

